/**
 * 报告样式定义
 * 
 * 提供统一的报告PDF样式，确保与模板保持一致
 * 
 * @author 矿山安全评价系统开发团队
 * @version 1.0.0
 */

export const reportStyles = `
  <style>
    @page {
      size: A4;
      margin: 0;
    }
    
    body {
      margin: 0;
      padding: 0;
      font-family: 'Microsoft YaHei', Arial, sans-serif;
      font-size: 12px;
      line-height: 1.4;
      color: #333;
      background: white;
    }
    
    /* 封面样式 */
    .cover-page {
      width: 210mm;
      height: 297mm;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
      page-break-after: always;
      background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
      position: relative;
      box-sizing: border-box;
    }
    
    .cover-title {
      font-size: 36px;
      font-weight: bold;
      color: #2c3e50;
      margin-bottom: 20px;
      text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
      line-height: 1.2;
    }
    
    .cover-subtitle {
      font-size: 18px;
      color: #6c757d;
      margin-bottom: 60px;
      font-weight: 500;
    }
    
    .cover-info {
      position: absolute;
      bottom: 80px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 14px;
      color: #495057;
      line-height: 2;
      text-align: left;
      background: rgba(255, 255, 255, 0.9);
      padding: 20px;
      border-radius: 8px;
      box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .cover-info div {
      margin-bottom: 8px;
    }
    
    .cover-info strong {
      color: #2c3e50;
    }
    
    /* 内容页样式 */
    .content-page {
      width: 210mm;
      min-height: 297mm;
      padding: 20mm;
      box-sizing: border-box;
    }
    
    .section {
      margin-bottom: 25px;
      background: #f8f9fa;
      border-radius: 8px;
      padding: 15px;
      border: 1px solid #e9ecef;
    }
    
    .section h2 {
      color: #2c3e50;
      margin-bottom: 15px;
      font-size: 18px;
      font-weight: 600;
      border-bottom: 2px solid #3498db;
      padding-bottom: 8px;
    }
    
    .info-table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 15px;
      background: white;
      border-radius: 8px;
      overflow: hidden;
    }
    
    .info-table td {
      padding: 8px 12px;
      border: 1px solid #dee2e6;
      font-size: 12px;
    }
    
    .info-table td:first-child {
      background: #f8f9fa;
      font-weight: 600;
      color: #495057;
      width: 120px;
    }
    
    .safety-level-display {
      text-align: center;
      margin: 20px 0;
    }
    
    .safety-level-badge {
      display: inline-block;
      padding: 15px 30px;
      border-radius: 8px;
      font-size: 24px;
      font-weight: bold;
      color: white;
      background: #dc3545;
    }
    
    .safety-level-badge.level-a {
      background: #28a745;
    }
    
    .safety-level-badge.level-b {
      background: #17a2b8;
    }
    
    .safety-level-badge.level-c {
      background: #ffc107;
      color: #212529;
    }
    
    .safety-level-badge.level-d {
      background: #dc3545;
    }
    
    .indicators-table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 15px;
      font-size: 10px;
      background: white;
      border-radius: 8px;
      overflow: hidden;
    }
    
    .indicators-table th {
      background: #3498db;
      color: white;
      padding: 8px 6px;
      text-align: center;
      font-weight: 600;
    }
    
    .indicators-table td {
      padding: 6px 4px;
      border: 1px solid #dee2e6;
      text-align: center;
      font-size: 10px;
    }
    
    .indicators-table .low-score {
      background: #fff3cd;
      color: #856404;
      font-weight: bold;
    }
    
    .remediation-item {
      margin-bottom: 15px;
      padding: 12px;
      border: 1px solid #dee2e6;
      border-left: 4px solid #dc3545;
      background: #f8f9fa;
      border-radius: 4px;
    }
    
    .remediation-header {
      font-weight: 600;
      color: #2c3e50;
      margin-bottom: 8px;
      font-size: 13px;
    }
    
    .remediation-condition {
      color: #6c757d;
      font-size: 11px;
      margin-bottom: 6px;
    }
    
    .remediation-content {
      color: #495057;
      line-height: 1.5;
      font-size: 11px;
    }
    
    h3 {
      color: #2c3e50;
      font-size: 16px;
      font-weight: 600;
      margin: 20px 0 15px 0;
      border-bottom: 1px solid #dee2e6;
      padding-bottom: 5px;
    }
    
    h4 {
      color: #34495e;
      font-size: 14px;
      font-weight: 600;
      margin: 15px 0 10px 0;
    }
    
    p {
      margin-bottom: 12px;
      line-height: 1.6;
      text-align: justify;
    }
    
    ol, ul {
      margin-bottom: 15px;
      padding-left: 20px;
    }
    
    ol li, ul li {
      margin-bottom: 8px;
      line-height: 1.5;
    }
    
    strong {
      color: #2c3e50;
      font-weight: 600;
    }
    
    .safety-level-table {
      width: 100%;
      border-collapse: collapse;
      margin: 20px 0;
      font-size: 12px;
    }
    
    .safety-level-table th,
    .safety-level-table td {
      border: 1px solid #dee2e6;
      padding: 8px 12px;
      text-align: left;
    }
    
    .safety-level-table th {
      background-color: #f8f9fa;
      font-weight: 600;
      color: #495057;
    }
    
    .safety-level-table tbody tr:nth-child(even) {
      background-color: #f8f9fa;
    }
    
    .safety-level-table tbody tr:hover {
      background-color: #e9ecef;
    }
    
    /* 打印样式 */
    @media print {
      body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
      }
      
      .cover-page {
        page-break-after: always;
      }
      
      .section {
        page-break-inside: avoid;
      }
    }
  </style>
`

/**
 * 生成完整的报告HTML，包含样式
 * @param content 报告内容HTML
 * @returns 完整的HTML文档
 */
export function generateFullReportHTML(content: string): string {
  return `
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>矿山安全评价报告</title>
      ${reportStyles}
    </head>
    <body>
      ${content}
    </body>
    </html>
  `
}
